package other.process;

/**
 * @Author jlj
 * @Date 2022-06-09 10:53
 * @Description
 * @Modified
 */
public enum DbType {
    PostGIS(0, "PostGIS"),
    HBase(1, "HBase"),
    HDFS(2, "HDFS"),
    MySQL(3, "MySQL"),
    Oracle(4, "Oracle"),
    KafKa(5, "Kafka"),
    HTTP(6, "HTTP"),
    FTP(7, "FTP"),
    LocalDisk(8, "LocalDisk"),
    Unsupported(99, "UnsupportedType");

    private final int dbType;
    private final String name;

    private DbType(int index, String name) {
        this.dbType = index;
        this.name = name;
    }

    public int getType() {
        return dbType;
    }

    public String getName() {
        return name;
    }

    public static DbType getDbType(int value) {
        for (DbType type : DbType.values()) {
            if (type.getType() == value) {
                return type;
            }
        }
        return Unsupported;
    }
}
